<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet [
  <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
  <!ENTITY dc "http://purl.org/dc/elements/1.1/">
  <!ENTITY dcterms "http://purl.org/dc/terms/">
  <!ENTITY foaf "http://xmlns.com/foaf/0.1/">
  <!ENTITY a "http://xmlns.heustics.org/schema/myelin/0.1/">
  <!ENTITY m "http://xmlns.heustics.org/ontology/myelin/0.1/">
]>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:a="http://xmlns.heustics.org/schema/myelin/0.1/" 
  xmlns:l="http://xmlns.heustics.org/schema/i18n/0.1/"
  xmlns:s="&a;search#"
  xmlns:o="&a;AgentAccount#search-memberships"
  xmlns:p="&a;AgentAccount#"
  exclude-result-prefixes="xsl a l o p s"
>   
  <xsl:variable name="o:l10n" select="a:get-l10n('&a;AgentAccount#search-memberships')"/> 
  <xsl:variable name="o:params-l10n" select="$o:l10n/l:context[@name='params']/*"/>
  <xsl:variable name="o:hints-l10n" select="$o:l10n/l:context[@name='param-hints']/*"/> 
  <xsl:variable name="o:search-list-l10n" select="$o:l10n/l:context[@name='search-list']/*"/> 
    
  <xsl:template match="a:nick" mode="a:input-show"> 
    <xsl:call-template name="p:nick-input">
      <xsl:with-param name="params-l10n" select="$o:params-l10n"/>
      <xsl:with-param name="hints-l10n" select="$o:hints-l10n"/>
    </xsl:call-template>
  </xsl:template>
  
   <xsl:template match="a:sort-by" mode="a:input-show">
    <xsl:call-template name="s:range">
      <xsl:with-param name="options" select="$o:l10n/l:context[@name='sort-by-options']/*"/> 
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:range" mode="a:input-show">
    <xsl:call-template name="s:range">
      <xsl:with-param name="options" select="$o:l10n/l:context[@name='range-options']/*"/> 
    </xsl:call-template>
  </xsl:template> 
  
  <xsl:template match="a:*[@node-id]" mode="a:main-instance" name="o:main-instance">    
    <xsl:param name="action" select="$a:action"/>
    <xsl:call-template name="s:main-instance">
      <xsl:with-param name='action' select="$a:action"/>
      <xsl:with-param name='type' select="string(a:search-params/a:type/@selected)"/>
    </xsl:call-template>
  </xsl:template>
  
  <xsl:template match="a:node[@key='agent']" mode="a:search-list">    
    <xsl:param name="l10n"/>
    
    <xsl:choose>
      <xsl:when test="@node-id">
        <xsl:call-template name="a:search-list-node">
          <xsl:with-param name="l10n" select="$l10n"/>
        </xsl:call-template>
      </xsl:when>
      <xsl:otherwise>
        <xsl:call-template name="o:no-profile-node"/>
      </xsl:otherwise>
    </xsl:choose>
    
    <div class="account-details">      
      
      <div class='entry nick'>
        <div class='key'>
          <span><xsl:value-of select="$o:search-list-l10n[@key='nick']"/></span>
          <div class="spacer"/>
        </div>
        <div class='value'>
          <span><xsl:value-of select='@nick'/></span>
          <div class="spacer"/>
        </div>             
        <div class='spacer'/>   
      </div>   
      
      <div class='entry name'>
        <div class='key'>
          <span><xsl:value-of select="$o:search-list-l10n[@key='name']"/></span>
          <div class="spacer"/>
        </div>
        <div class='value'>
          <span><xsl:value-of select='@name'/></span>
          <div class="spacer"/>
        </div>             
        <div class='spacer'/>   
      </div>   
      
      <div class='entry cdate'>
        <div class='key'>
          <span><xsl:value-of select="$o:search-list-l10n[@key='cdate']"/></span>
          <div class="spacer"/>
        </div>
        <div class='value'>
          <span><xsl:value-of select='substring-before(@account-cdate,"T")'/></span>
          <div class="spacer"/>
        </div>             
        <div class='spacer'/>   
      </div>         
      
      <!-- xsl:if test="@account-mdate">
        <div class='entry mdate'>
          <div class='key'>
            <xsl:value-of select="$o:search-list-l10n[@key='mdate']"/>
            <div class="spacer"/>
          </div>
          <div class='value'>
            <xsl:value-of select='a:format-date-time(@account-mdate)'/> 
            <div class="spacer"/>
          </div>             
          <div class='spacer'/>   
        </div>      
      </xsl:if -->     
              
      <div class="spacer"/>     
    </div> 
    
  </xsl:template>  
  
  <xsl:template name="o:no-profile-node">    
    <xsl:param name="name" select="@name"/>
    <div class="actions-and-title no-profile">
      <div class='title'>
        <span>
          <xsl:value-of select='$name'/>
        </span>
        <div class='spacer'/>   
      </div>     
      <div class='spacer'/> 
    </div>      
    <div class="metadata description">
      <span>
        <xsl:value-of select="$o:search-list-l10n[@key='no-profile-description']"/>
      </span>
      <div class='spacer'/>
    </div>          
  </xsl:template>  
    
</xsl:stylesheet>

